package org.dromara.oce.service.remote;

import com.bytedance.ads.model.*;
import org.dromara.common.core.domain.R;
import org.dromara.oce.domain.dto.ProjectPromotionAggregation;
import org.dromara.oce.domain.qo.*;
import org.dromara.oce.domain.req.*;
import org.dromara.oce.domain.vo.GetIesAccountSearchVo;

import java.io.File;
import java.util.List;

/**
 * @desc: 开放平台提供第三方授权服务接口
 * @author: hhl
 * @date：2025/5/29 16:41
 */
public interface OceanEngineThirdRemoteService {

    String getAccessToken(String account);

    String refreshToken(String account);




    /**
     * 1.获取已授权账户
     */
    List<Oauth2AdvertiserGetResponseDataListInner> getOauthAdvertiser(String appCode);

    /**
     * 2.获取授权User信息
     * @param account
     * @return
     */
    UserInfoV2ResponseData getOauthUserInfo(String account);

    /**
     * 3.获取工作台下账户列表
     */
    CustomerCenterAdvertiserListV2ResponseData getCustomerCenterAdvertiserList(GetAccountAdvertiserlistQo qo);

    /**
     * 4.查询广告主详细信息
     *
     * @param accountId     管理账户id
     * @param advertiserIds 广告主id
     * @return
     */
    List<AgentAdvertiserInfoQueryV2ResponseDataAccountDetailListInner> getAdvertiserInfo(Long accountId, List<Long> advertiserIds);

    /**
     * 获取广告主账户头像ID
     * @param advertiserId
     * @param file
     * @return
     */
    String uploadAdvertiserAvatar(Long advertiserId, File file);

    /**
     * 更新广告主账户头像
     * @param req
     * @return
     */
    Boolean updateAdvertiserAvatar(UpdateAdvertiserAvatarReq req);

    /**
     * 查询广告主账户头像
     * @param id
     * @return
     */
    AdvertiserAvatarGetV2ResponseData queryAdvertiserAvatar(Long id, String appCode);

    /**
     * 查询广告主账户当前绑定的抖音号信息
     *
     * @param qo
     * @return
     */
    List<GetIesAccountSearchVo> getIesAccountSearch(GetIesAccountSearchQo qo);


    /**
     * 获取工作台（原纵横组织）下所有主体
     * @param qo
     * @return
     */
    BusinessPlatformCompanyInfoGetV30ResponseData getAccountAllCompanyInfo(GetAccountAllCompanyInfoQo qo);

    /**
     * 1.资产 -> 商品库、（填写链接、剧集信息，剧的收费信息）
     * 2.1 抖小
     * 2.1.1  单账户->资产 -> 事件管理（转化追踪）
     *
     * 1项目->2~8广告
     * 1个广告->3个素材
     *
     * 微信
     *  新建小程序
     *  锚点
     *  橙子建站
     *
     *
     *
     */

    /**
     * 5.获取商品库列表
     *
     * @param accountId
     * @param advertiserId
     * @return
     */
    List<DpaProductAvailablesV2ResponseDataListInner> getDptProductAvailablesList(Long accountId, Long advertiserId);

    /**
     * 6.查询商品库下的所有商品
     * @return
     */
    List<DpaDetailGetV2ResponseDataListInner> getDptProductList(GetDptProductListPageQo req);

    /**
     * 查询商品详情
     * @param qo
     * @return
     */
    DpaProductDetailGetV2ResponseData getProductDetail(GetProductDetailQo qo);


    /**
     * 7.创建商品库
     * @param req
     * @return
     */
    boolean createDptProduct(CreateDptProductReq req);

    /**
     * 批量修改DPA商品状态
     *
     * @param req
     * @return
     */
    boolean updateBatchProductStatus(UpdateBatchProductStatusReq req);

    /**
     * 创建字节小程序
     * @param accountId
     * @param req
     */
    ToolsMicroAppCreateV30Response createToolsMicroApp(String accountId, CreateToolsMicroAppReq req);

    /**
     * 更新字节小程序
     * https://open.oceanengine.com/labels/8/docs/1780614097935372?origin=left_nav
     * @param accountId
     * @param req
     * @return
     */
    ToolsMicroAppUpdateV30Response updateToolsMicroApp(String accountId, UpdateToolsMicroAppReq req);

    /**
     * 获取字节小程序（单个广告主下）
     * https://open.oceanengine.com/labels/8/docs/1778249831680135?origin=left_nav
     */
    ToolsMicroAppListV30ResponseData getToolsMicroAppList(GetToolsMicroAppListQo qo);

    /**
     * 获取字节小程序/小游戏详情内容（查询小程序下配置的所有链接）
     * https://open.oceanengine.com/labels/8/docs/1778265753535620?origin=left_nav
     * @param accountId
     * @param qo
     */
    ToolsAssetLinkListV30ResponseData getToolsAssetLinkList(String accountId, GetToolsAssetLinkListPageQo qo);


    /**
     * 创建微信小程序
     * @param accountId
     * @param req
     * @return
     */
    ToolsWechatAppletCreateV30Response createToolsWechatAppletResponse(Long accountId, CreateToolsWechatAppletReq req);

    /**
     * 修改微信小程序
     * @param accountId
     * @param req
     * @return
     */
    ToolsWechatAppletUpdateV30ResponseData updateToolsWechatApplet(Long accountId, UpdateToolsWechatAppletReq req);

    /**
     * 获取微信小程序（单个广告主下）
     */
    ToolsWechatAppletListV30ResponseData getToolsWechatAppletList(GetToolsWechatAppletListQo qo);

    /**
     * 设置小程序&小游戏共享资产
     */
    boolean shareDpAssetManagement(String accountId, ShareDpAssetManagementReq req);

    /**
     * 取消小游戏/小程序共享关系
     *
     * @param accountId
     * @param req
     */
    boolean cancelShareDpAssetManagement(String accountId, ShareDpAssetManagementReq req);

    /**
     * 查看小游戏/小程序共享范围
     * @param accountId
     * @param qo
     */
    ToolsBpAssetManagementShareGetV30ResponseData getShareDpAssetManagement(String accountId, Long instanceId, ToolsBpAssetManagementShareGetV30AssetType assetTyp);

    /**
     * 获取账户下资产列表（新）
     * @param accountId
     * @param qo
     * @return
     */
    ToolsEventAllAssetsListV2ResponseData getEventAllAssetsList(Long accountId, GetEventAllAssetsListPageQo qo);

    /**
     * 获取已创建资产详情（新）
     * https://open.oceanengine.com/labels/7/docs/1800988620664954?origin=left_nav
     *
     * @param accountId
     * @param advertiserId
     * @param assetIds
     * @return
     */
    List<ToolsEventAllAssetsDetailV2ResponseDataAssetListInner> getEventAllAssetsDetail(Long accountId, Long advertiserId, List<Long> assetIds);


    /**
     * 获取资产下已创建事件列表
     * @param accountId
     * @param qo
     * @return
     */
    List<EventManagerEventConfigsGetV2ResponseDataEventConfigsInner> getEventManagerConfigs(Long accountId, GetEventManagerConfigsPageQo qo);

    /**
     * 获取可创建事件列表
     *
     * @param accountId    管家账号id
     * @param advertiserId 广告主ID
     * @param assetId      账户下资产ID
     * @return
     */
    List<EventManagerAvailableEventsGetV2ResponseDataEventConfigsInner> getEventManagerAvailableEventsList(Long accountId, Long advertiserId, Long assetId);

    /**
     * 创建事件资产
     *
     * @return
     */
    boolean createEventManagerAssets(Long accountId, CreateEventManagerAssetsReq req);

    /**
     * 资产下创建事件
     * @param req
     * @return
     */
    boolean createEventManagerEvents(CreateEventManagerEventsReq req);




    FileImageAdV2ResponseData uploadImage(Long accountId, Long advertiserId, File file, String imageMd5);

    List<FileImageGetV2ResponseDataListInner> getImageList(Long accountId, Long advertiserId, Long page, Long pageSize);

    /**
     *  上传视频
     * @return
     */
    FileVideoAdV2ResponseData uploadVideo(Long accountId, UploadVideoReq req,File file);

    /**
     * 获取广告主下视频素材
     *
     * @param qo
     * @return
     */
    FileVideoGetV2ResponseData getVideoList(GetVideoListQo qo);

    /**
     * 获取图片素材
     * @param qo
     * @return
     */
    FileImageGetV2ResponseData getImageList(GetImageListQo qo);

    /**
     * 获取视频素材评估标签（新版）
     *
     * @param qo
     * @return
     */
    FileMaterialAttributesListV2ResponseData getMaterialAttributesDetail(GetMaterialAttributesDetailQo qo);

    /**
     * 素材推送
     * @param req
     */
    void bindMaterial(BindMaterialReq req);



    List<ProjectListV30ResponseDataListInner> projectList(Long accountId, Long advertiserId, List<String> fields, ProjectListV30Filtering filtering, Long page, Long pageSize);

    /**
     * 创建橙子建站站点/落地页
     * @param accountId
     * @param req
     * @return
     */
    boolean createToolsSite(String accountId, CreateToolsSiteCreateV2Request req);

    boolean updateToolsSite(String accountId, UpdateToolsSiteCreateV2Request req);

    boolean updateStatusToolsSite(String accountId, UpdateStatusToolsSiteCreateV2Request req);

    /**
     * 获取橙子建站站点预览地址
     * @param advertiserId
     * @param accountId
     * @param siteId
     * @return
     */
    ToolsSitePreviewV2Response getToolsSitePreview(Long advertiserId, String accountId, String siteId);

    ToolsSiteReadV2Response getToolsSiteRead(Long advertiserId, String accountId, String siteId);

    /**
     * 获取橙子建站站点列表
     * @param accountId
     * @param req
     * @return
     */
    ToolsSiteGetV2ResponseData getToolsSiteList(Long accountId, ToolsSiteListV2Request req);

    /**
     * 创建原生锚点
     * @param accountId
     * @param req
     * @return
     */
    boolean createNativeAnchor(String accountId, CreateNativeAnchorV3Request req);

    /**
     * 修改原生锚点
     * @param accountId
     * @param req
     * @return
     */
    boolean updateNativeAnchor(String accountId, UpdateNativeAnchorV3Request req);

    /**
     * 删除原生锚点
     * @param accountId
     * @param advertiserId
     * @param anchorId
     * @return
     */
    boolean deleteNativeAnchor(String accountId, Long advertiserId, String anchorId);

    NativeAnchorGetV30Response getNativeAnchor(GetNativeAnchorV3Request qo);

    NativeAnchorGetDetailV30ResponseData getNativeAnchorDetail(GetDetailNativeAnchorV3Request qo);

    NativeAnchorQrcodePreviewGetV30ResponseData getNativeAnchorQrcode(GetDetailNativeAnchorV3Request qo);

    /**
     * 创建项目
     * @param accountId
     * @param req
     * @return
     */
    Long createProject(Long accountId, ProjectCreateV30Request2 req);

    ProjectListV30ResponseData getProjectList(String accountId, Long advertiserId,List<Long> ids,  ProjectListV30FilteringStatus status, Long pageNum, Long pageSize);

    boolean updateProject(String accountId, UpdateProjectV3Request req);

    EventManagerOptimizedGoalGetV2V30ResponseData getEventManagerOptimizedGoal(GetEventManagerV3Request qo);

    EventManagerDeepBidTypeGetV30ResponseData getEventManagerDeepBidType(GetEventManagerDeepBidTypeV3Request qo);

    Boolean updateProjectStats(UpdateProjectStatusV3Request qo);

    ProjectDeleteV30ResponseData deleteProject(DeleteProjectV3Request qo);

    /**
     * 创建广告
     * @param accountId
     * @param req
     * @return
     */
    boolean createPromotion(Long accountId, CreatePromotionV3Request req);

    boolean updatePromotion(String accountId, UpdatePromotionV3Request req);

    PromotionListV30ResponseData getPromotionList(GetPromotionListV3Request req);

    Boolean updatePromotiontStatus(UpdatePromotionStatusV3Request qo);

    Boolean deletePromotiont(DeletePromotionV3Request qo);

    List<ToolsMicroAppListV30ResponseDataListInner> queryToolsMicroAppNew(GetToolsMicroAppListQo qo);

    /**
     * 批量创建项目、广告
     * @param accountId
     * @param req
     * @param appCode
     * @return
     */
    R createProjectPromotion(Long accountId, CreateProjectPromotionQo req, String appCode);

    /**
     * 批量创建项目、广告预览
     * @param accountId
     * @param req
     * @param appCode
     * @return
     */
    R<List<ProjectPromotionAggregation>> createProjectPromotionPreview(Long accountId, CreateProjectPromotionQo req, String appCode);

    ToolsAdminInfoV2ResponseData getAdminInfo(GetAdminInfoV2Request qo);
}
